home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / Palettes / Calendar / CalendarInspector.m < prev    next >
Text File  |  1995-06-12  |  2KB  |  70 lines

  1. //----------------------------------------------------------------------------------------------------
  2. //
  3. //    CalendarInspector
  4. //
  5. //    Inherits From:        IBInspector
  6. //
  7. //    Declared In:        CalendarInspector.h
  8. //
  9. //    Disclaimer
  10. //
  11. //        You may freely copy, distribute and reuse this software and its
  12. //        associated documentation. I disclaim any warranty of any kind, 
  13. //        expressed or implied, as to its fitness for any particular use.
  14. //
  15. //----------------------------------------------------------------------------------------------------
  16. #import "CalendarInspector.h"
  17. #import "Calendar.h"
  18.  
  19.  
  20. @implementation CalendarInspector
  21.  
  22. - init
  23. {
  24.     //  Initialize and return an instance of this class.        
  25.         char     path[MAXPATHLEN+1];
  26.         id         bundle;
  27.         
  28.         [super init];
  29.         if ( ! (bundle = [NXBundle bundleForClass: [CalendarInspector class]] ) ) return nil;        if ( ! [bundle getPath: path forResource: "CalendarInspector" ofType: "nib"] ) return nil;
  30.         [NXApp loadNibFile: path owner: self  withNames: NO fromZone: [self zone]];
  31.         return self;
  32. }
  33.  
  34.  
  35. - revert:sender
  36. {
  37.     //  Sync with inspected object.
  38.     
  39.     [calendar month: [object monthIntValue]];
  40.     [calendar day: [object dayIntValue]];
  41.     [calendar year: [object yearIntValue]];
  42.     [disableButton setState: ! [object isEnabled]];
  43.  
  44.         return [super revert:sender];
  45. }
  46.  
  47.  
  48. - ok: sender
  49. {
  50.     //  Make changes to object .  Notify IB changes have occurred.
  51.  
  52.     [object month: [calendar monthIntValue]];
  53.     [object day: [calendar dayIntValue]];
  54.     [object year: [calendar yearIntValue]];
  55.     [object setEnabled: ! [disableButton state]];
  56.  
  57.     [[NXApp activeDocument] touch];
  58.         return [super ok: sender];
  59. }
  60.  
  61.  
  62. - (BOOL)wantsButtons
  63. {
  64.     //  Tell IB we want 'Revert' and 'Ok' buttons.
  65.  
  66.         return YES;
  67. }
  68.  
  69.  
  70. @end